<template>
  <div class="app-container">
    <header>
      <div class="logo">
        <img alt="系统 logo" src="@/assets/logo.svg" width="40" height="40" />
        <h1>环境监控系统</h1>
      </div>

      <nav>
        <RouterLink to="/" class="nav-item">系统概览</RouterLink>
        <RouterLink to="/sensor" class="nav-item">传感器监控</RouterLink>
        <RouterLink to="/alarm" class="nav-item">报警管理</RouterLink>
        <RouterLink to="/cabin" class="nav-item">舱体管理</RouterLink>
        <RouterLink to="/settings" class="nav-item">系统设置</RouterLink>
      </nav>
    </header>

    <main>
      <RouterView />
    </main>
  </div>
</template>

<style scoped>
#id{
  margin: 0;
  padding: 0;
  /* width: 100vw; */
}
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow-x: hidden;
}

header {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo h1 {
  font-size: 1.5rem;
  margin: 0;
  white-space: nowrap; /* 防止文字换行 */
}

nav {
  margin-left: auto;
  display: flex;
  gap: 2rem;
}

.nav-item {
  text-decoration: none;
  color: #666;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  white-space: nowrap; /* 防止导航文字换行 */
}

.nav-item.router-link-active {
  color: #409EFF;
  background: #ecf5ff;
}

main {
  flex: 1;
  /* padding: 2rem; */
  background: #f5f7fa;
}
</style>